- /* sdfexbsr.cpp by K.Tsuru */
- /***********************************************************************
- It evaluates exp(n/d) with ExpBSRType n and d using binary splitting method.
- ************************************************************************/
-
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- static const char* const func = "ExpBSR()";
- typedef SLong ExpBSRType; // SLong version exp(sqrt(2.0)) 3.6(sec) in 40,000 decimals
- // typedef SDouble ExpBSRType; // SDouble version 4.2 (sec)
-
- /******************************************************
- It returns the value exp(n/d) as a rational number a/c.
- ******************************************************/
- // function ID = 3317 ver. 2.18
- static SDouble C;
-
- void ExpBSR(const SLong& n, const SLong& d, SLong& a, SLong& c) {
- long prec = long(C.EffFig() + C.Hidden()) * DFIGURES;
- double log10x = n.DFigures() - d.DFigures();
- if(log10x > 0) C.SetError(C.SYNTAX_ERR, func, 3317);
- long L = upToExpSeries(prec, log10x + 1);
- ExpBSRationalNumber<ExpBSRType> expX(L, prec, n, d); // defined in "sbstempl.h"
-
- expX.putTogether();
- a = expX.getA(); c = expX.getC(); // expX.getAC(a, c);
- }
- /**********************************************************
- It evaluates exp(n/d). Condition n < d must be satisfied.
- ******************************************************/
- // function ID = 3316 ver. 2.18
- SDouble ExpBSR(const SLong& n, const SLong& d) {
- SLong a, c;
-
- ExpBSR(n, d, a, c);
-
- return SDouble(a) / SDouble(c);
- }
sdfexbsr.cpp : last modifiled at 2015/05/24 15:45:43(1,497 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).